<%@ page language="java" pageEncoding="utf-8" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>手机管理系统</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/file.css"/>
</head>
<body>
<div class="navbar">
    <div class="container">
        <a class="logo" href="#">手机管理系统</a>
        <nav class="userbar">
            <ul class="cl">
                <li class="lfet">欢迎:</li>
                <li class="lfet">admin</li>
                <li class="lfet"><a href="" style="color: #fff;">退出</a></li>
            </ul>
        </nav>
    </div>
</div>
<div class="article">
    <div class="bor">
        <div class="bg">
					<span class="lfet">
						<a href="${pageContext.request.contextPath}/addphone.jsp" class="btn btn-primary radius">添加手机</a>
						<a href="${pageContext.request.contextPath}/phone/p_selectBrand" class="btn btn-primary radius">品牌管理</a>
					</span>
        </div>
        <div>
            <form action="${pageContext.request.contextPath}/phone/p_deletePhone">
                <table class="table table-border table-bordered table-hover table-bg table-sort">
                    <thead>
                    <tr class="text-c">
                        <th width="25"><input type="submit" class="btn btn-primary radius" value="批量删除"/></th>
                        <th width="80">ID</th>
                        <th width="80">手机名称</th>
                        <th width="80">价格</th>
                        <th width="80">状态</th>
                        <th width="80">品牌</th>
                        <th width="130">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <%--//ID--%>
                    <%--private Integer brandId;--%>
                    <%--//品牌名字--%>
                    <%--private String brandName;--%>
                    <%--//品牌的多个手机--%>
                    <%--private List<Phone> phone;--%>


                        <%--//ID--%>
                        <%--private Integer phoneId;--%>
                        <%--//手机名--%>
                        <%--private String phoneName;--%>
                        <%--//手机价钱--%>
                        <%--private Double ;--%>
                        <%--//上架  下架--%>
                        <%--private Integer phoneState;--%>
                        <%--//品牌--%>
                        <%--private Brand brand;--%>
                    <c:forEach var="p" items="${requestScope.phones}">
                        <tr class="text-c">
                            <td><input type="checkbox" value="${p.phoneId}" name="phoneId"></td>
                            <td>${p.phoneId}</td>
                            <td>${p.phoneName}</td>
                            <td>${p.phonePrice}</td>
                            <c:if test="${p.phoneState==1}">
                            <td class="td-status"><span class="label label-success radius">有货</span></td>
                            </c:if>
                            <c:if test="${p.phoneState==2}">
                                <td class="td-status"><span class="label label-error radius">无货</span></td>
                            </c:if>
                            <td>${p.brand.brandName}</td>
                            <td class="td-manage">
                                <a style="text-decoration:none" href="${pageContext.request.contextPath}/phone/p_deletePhone?phoneId=${p.phoneId}">删除</a>
                                <a style="text-decoration:none" href="${pageContext.request.contextPath}/phone/p_selectPhoneOne?id=${p.phoneId}">修改</a>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </form>
        </div>
        <div class="dataTables_info" id="DataTables_info">当前是第<span>${requestScope.page}</span>页 ，共 <span>${sum}</span>页</div>
        <div class="dataTables_paginate" id="DataTables_paginate">
            <c:if test="${page>1}">
                <a class="paginate_button" id="previous" href="${pageContext.request.contextPath}/phone/p_selectPhone?page=${requestScope.page-1}&pows=${requestScope.rows}">上一页</a>
            </c:if>
            <c:if test="${page<sum}">
                <a class="paginate_button" id="next" href="${pageContext.request.contextPath}/phone/p_selectPhone?page=${requestScope.page+1}&pows=${requestScope.rows}">下一页</a>
            </c:if>
        </div>
    </div>
</div>
</body>
</html>
